package com.ssn.jse.polymorphism;

public class LateBinding
{
	public static void main(String[] args)
	{
		A a=null;
		if(args[0].equals("1")){
			a=new B();
		}else if (args[0].equals("2")) {
			a=new C();
		}else if (args[0].equals("3")) {
			a=new D();
		}
		a.methord();
	}
}

class A{
	public void methord(){
		System.out.println("A");
	}
}

class B extends A{
	public void methord(){
		System.out.println("B");
	}
}
class C extends A{
	public void methord(){
		System.out.println("C");
	}
}
class D extends A{
	public void methord(){
		System.out.println("D");
	}
}